package com.sanjiahantang.youjiaclient.module.me.order.beans;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.sanjiahantang.youjiaclient.base.BaseBean;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.Serializable;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
 * Created by admin on 2017/10/27.
 */

public class ShopListBean extends BaseBean {
    private String data;


    public PayVo getPayVoBean() {
        try {
            return new Gson().fromJson(data, PayVo.class);
        } catch (Exception e) {
            return null;
        }
    }

    public List<Data> getData() {
        ShopList list = new Gson().fromJson(data, ShopList.class);
        if (list == null) {
            return new ArrayList<>();
        }
        return new Gson().fromJson(data, ShopList.class).getList();
    }

    public void setData(String data) {
        this.data = data;
    }

    public Data getItem() {
        FirstData firstData = new Gson().fromJson(data, FirstData.class);
        if (firstData == null || firstData.getOrderInfoGoodsRaDtoList() == null || firstData.getOrderInfoGoodsRaDtoList().size() == 0) {
            return null;
        }
        Data secondData = firstData.getOrderInfoGoodsRaDtoList().get(0);
        return secondData;
    }

    public static class ShopList extends ListBean {
        private List<Data> list;

        public List<Data> getList() {
            return list;
        }

        public void setList(List<Data> list) {
            this.list = list;
        }
    }

    public static class FirstData implements Serializable {

        private String buyPersonMessage;
        private String createTime;
        private String customerFaPhone;
        private int oiId;
        private String orderCode;
        private String payTemplateName;
        private ArrayList<Data> orderInfoGoodsRaDtoList;

        public ArrayList<Data> getOrderInfoGoodsRaDtoList() {
            return orderInfoGoodsRaDtoList;
        }

        public void setOrderInfoGoodsRaDtoList(ArrayList<Data> orderInfoGoodsRaDtoList) {
            this.orderInfoGoodsRaDtoList = orderInfoGoodsRaDtoList;
        }

        public static FirstData objectFromData(String str) {

            return new Gson().fromJson(str, FirstData.class);
        }

        public static FirstData objectFromData(String str, String key) {

            try {
                JSONObject jsonObject = new JSONObject(str);

                return new Gson().fromJson(jsonObject.getString(str), FirstData.class);
            } catch (JSONException e) {
                e.printStackTrace();
            }

            return null;
        }

        public static List<FirstData> arrayFirstDataFromData(String str) {

            Type listType = new TypeToken<ArrayList<FirstData>>() {
            }.getType();

            return new Gson().fromJson(str, listType);
        }

        public static List<FirstData> arrayFirstDataFromData(String str, String key) {

            try {
                JSONObject jsonObject = new JSONObject(str);
                Type listType = new TypeToken<ArrayList<FirstData>>() {
                }.getType();

                return new Gson().fromJson(jsonObject.getString(str), listType);

            } catch (JSONException e) {
                e.printStackTrace();
            }

            return new ArrayList();


        }

        public String getBuyPersonMessage() {
            return buyPersonMessage;
        }

        public void setBuyPersonMessage(String buyPersonMessage) {
            this.buyPersonMessage = buyPersonMessage;
        }

        public String getCreateTime() {
            return createTime;
        }

        public void setCreateTime(String createTime) {
            this.createTime = createTime;
        }

        public String getCustomerFaPhone() {
            return customerFaPhone;
        }

        public void setCustomerFaPhone(String customerFaPhone) {
            this.customerFaPhone = customerFaPhone;
        }

        public int getOiId() {
            return oiId;
        }

        public void setOiId(int oiId) {
            this.oiId = oiId;
        }

        public String getOrderCode() {
            return orderCode;
        }

        public void setOrderCode(String orderCode) {
            this.orderCode = orderCode;
        }

        public String getPayTemplateName() {
            return payTemplateName;
        }

        public void setPayTemplateName(String payTemplateName) {
            this.payTemplateName = payTemplateName;
        }
    }

    public static class Data implements Serializable {
        /**
         * goodsInfoDtoList : [{"count":1,"id":357,"isRefund":0,"ograFaId":130,"orderRecordCode":"1509011190001-0-0","payCount":0,"payResult":200,"payTemplateCount":1,"price":200,"recordName":"跳跳沙发","result":200,"skuFaId":1507619613856,"statusId":0,"statusName":"未付款","url":"upload/2017/10/10/123.jpg"}]
         * ograId : 130
         * oiFaId : 36
         * orderCode : 1509011190001-0
         * orderType : 3
         * payMoney : 200
         * payResult : 200
         * serviceType : 3
         * statusId : 10
         * statusName : 未付款
         * userAddressId : 2
         */


        private String createTime;
        private int ograId;
        private int oiFaId;
        private String orderCode;
        private int orderType;
        private float payMoney;
        private float payResult;
        private int serviceType;
        private String orderTypeId;
        private int statusId;
        private String statusName;
        private int userAddressId;
        private ArrayList<GoodsInfoDtoListBean> goodsInfoDtoList;
        private String token;
        private int phoneTypeId;
        private String buyPersonMessage;
        private float areadyResult;
        private String inputPsd;
        private HashMap<String, String> jdOrderInfo;
        private ArrayList<HashMap<String, String>> mOrderInfo;

        private String payPwd;
        private CreateOrderPost.OrderInvoiceInfoDtoBean orderInvoiceInfoDto;
        private PayVo payVo;
        private int isPos = 0;

        public int getIsPos() {
            return isPos;
        }

        public void setIsPos(int isPos) {
            this.isPos = isPos;
        }

        public String getOrderTypeId() {
            return orderTypeId;
        }

        public void setOrderTypeId(String orderTypeId) {
            this.orderTypeId = orderTypeId;
        }

        public float getPayMoney() {
            return payMoney;
        }

        public void setPayMoney(float payMoney) {
            this.payMoney = payMoney;
        }

        public float getPayResult() {
            return payResult;
        }

        public void setPayResult(float payResult) {
            this.payResult = payResult;
        }

        public String getBuyPersonMessage() {
            return buyPersonMessage;
        }

        public void setBuyPersonMessage(String buyPersonMessage) {
            this.buyPersonMessage = buyPersonMessage;
        }

        public CreateOrderPost.OrderInvoiceInfoDtoBean getOrderInvoiceInfoDto() {
            return orderInvoiceInfoDto;
        }

        public void setOrderInvoiceInfoDto(CreateOrderPost.OrderInvoiceInfoDtoBean orderInvoiceInfoDto) {
            this.orderInvoiceInfoDto = orderInvoiceInfoDto;
        }

        public String getInputPsd() {
            return inputPsd;
        }

        public void setInputPsd(String inputPsd) {
            this.inputPsd = inputPsd;
        }

        public String getCreateTime() {
            return createTime;
        }

        public void setCreateTime(String createTime) {
            this.createTime = createTime;
        }

        public String getToken() {
            return token;
        }

        public void setToken(String token) {
            this.token = token;
        }

        public int getPhoneTypeId() {
            return phoneTypeId;
        }

        public void setPhoneTypeId(int phoneTypeId) {
            this.phoneTypeId = phoneTypeId;
        }

        public int getOgraId() {
            return ograId;
        }

        public void setOgraId(int ograId) {
            this.ograId = ograId;
        }

        public int getOiFaId() {
            return oiFaId;
        }

        public void setOiFaId(int oiFaId) {
            this.oiFaId = oiFaId;
        }

        public String getOrderCode() {
            return orderCode;
        }

        public void setOrderCode(String orderCode) {
            this.orderCode = orderCode;
        }

        public int getOrderType() {
            return orderType;
        }

        public void setOrderType(int orderType) {
            this.orderType = orderType;
        }

        public String getPayPwd() {
            return payPwd;
        }

        public void setPayPwd(String payPwd) {
            this.payPwd = payPwd;
        }

        public int getServiceType() {
            return serviceType;
        }

        public void setServiceType(int serviceType) {
            this.serviceType = serviceType;
        }

        public int getStatusId() {
            return statusId;
        }

        public void setStatusId(int statusId) {
            this.statusId = statusId;
        }

        public String getStatusName() {
            return statusName;
        }

        public void setStatusName(String statusName) {
            this.statusName = statusName;
        }

        public int getUserAddressId() {
            return userAddressId;
        }

        public void setUserAddressId(int userAddressId) {
            this.userAddressId = userAddressId;
        }

        public ArrayList<GoodsInfoDtoListBean> getGoodsInfoDtoList() {
            return goodsInfoDtoList;
        }

        public void setGoodsInfoDtoList(ArrayList<GoodsInfoDtoListBean> goodsInfoDtoList) {
            this.goodsInfoDtoList = goodsInfoDtoList;
        }

        public float getAreadyResult() {
            return areadyResult;
        }

        public void setAreadyResult(float areadyResult) {
            this.areadyResult = areadyResult;
        }


        public PayVo getPayVo() {
            return payVo;
        }

        public void setPayVo(PayVo payVo) {
            this.payVo = payVo;
        }

        public HashMap<String, String> getJdOrderInfo() {
            return jdOrderInfo;
        }

        public void setJdOrderInfo(HashMap<String, String> jdOrderInfo) {
            this.jdOrderInfo = jdOrderInfo;
        }

        public ArrayList<HashMap<String, String>> getmOrderInfo() {
            return mOrderInfo;
        }

        public void setmOrderInfo(ArrayList<HashMap<String, String>> mOrderInfo) {
            this.mOrderInfo = mOrderInfo;
        }

        public static class GoodsInfoDtoListBean implements Serializable {
            /**
             * count : 1
             * id : 357
             * isRefund : 0
             * ograFaId : 130
             * orderRecordCode : 1509011190001-0-0
             * payCount : 0
             * payResult : 200
             * payTemplateCount : 1
             * price : 200
             * recordName : 跳跳沙发
             * result : 200
             * skuFaId : 1507619613856
             * statusId : 0
             * statusName : 未付款
             * url : upload/2017/10/10/123.jpg
             */

            private int count;
            private int id;
            private int isRefund;
            private int ograFaId;
            private String orderRecordCode;
            private int payCount;
            private float payResult;
            private int payTemplateCount;
            private float price;
            private String recordName;
            private float result;
            private long skuFaId;
            private int statusId;
            private String statusName;
            private String url;
            private String mgpiValue;
            private String supplyStateId;
            private String supplyStateName;
            private int mgiId;
            private String reduceMoney;
            private String reduceNum;
            private String expressCode;
            private String expressNumber;

            public String getExpressCode() {
                return expressCode;
            }

            public void setExpressCode(String expressCode) {
                this.expressCode = expressCode;
            }

            public String getExpressNumber() {
                return expressNumber;
            }

            public void setExpressNumber(String expressNumber) {
                this.expressNumber = expressNumber;
            }

            public String getReduceMoney() {
                return reduceMoney;
            }

            public void setReduceMoney(String reduceMoney) {
                this.reduceMoney = reduceMoney;
            }

            public String getReduceNum() {
                return reduceNum;
            }

            public void setReduceNum(String reduceNum) {
                this.reduceNum = reduceNum;
            }

            private String onePay;
            private String twoPay;
            private String threePay;

            public String getOnePay() {
                return onePay;
            }

            public void setOnePay(String onePay) {
                this.onePay = onePay;
            }

            public String getTwoPay() {
                return twoPay;
            }

            public void setTwoPay(String twoPay) {
                this.twoPay = twoPay;
            }

            public String getThreePay() {
                return threePay;
            }

            public void setThreePay(String threePay) {
                this.threePay = threePay;
            }

            public float getPayResult() {
                return payResult;
            }

            public void setPayResult(float payResult) {
                this.payResult = payResult;
            }

            public int getMgiId() {
                return mgiId;
            }

            public void setMgiId(int mgiId) {
                this.mgiId = mgiId;
            }

            public String getSupplyStateId() {
                return supplyStateId;
            }

            public void setSupplyStateId(String supplyStateId) {
                this.supplyStateId = supplyStateId;
            }

            public String getSupplyStateName() {
                return supplyStateName;
            }

            public void setSupplyStateName(String supplyStateName) {
                this.supplyStateName = supplyStateName;
            }

            public String getMgpiValue() {
                return mgpiValue;
            }

            public void setMgpiValue(String mgpiValue) {
                this.mgpiValue = mgpiValue;
            }

            public int getCount() {
                return count;
            }

            public void setCount(int count) {
                this.count = count;
            }

            public int getId() {
                return id;
            }

            public void setId(int id) {
                this.id = id;
            }

            public int getIsRefund() {
                return isRefund;
            }

            public void setIsRefund(int isRefund) {
                this.isRefund = isRefund;
            }

            public int getOgraFaId() {
                return ograFaId;
            }

            public void setOgraFaId(int ograFaId) {
                this.ograFaId = ograFaId;
            }

            public String getOrderRecordCode() {
                return orderRecordCode;
            }

            public void setOrderRecordCode(String orderRecordCode) {
                this.orderRecordCode = orderRecordCode;
            }

            public int getPayCount() {
                return payCount;
            }

            public void setPayCount(int payCount) {
                this.payCount = payCount;
            }


            public int getPayTemplateCount() {
                return payTemplateCount;
            }

            public void setPayTemplateCount(int payTemplateCount) {
                this.payTemplateCount = payTemplateCount;
            }

            public float getPrice() {
                return price;
            }

            public void setPrice(float price) {
                this.price = price;
            }

            public String getRecordName() {
                return recordName;
            }

            public void setRecordName(String recordName) {
                this.recordName = recordName;
            }

            public float getResult() {
                return result;
            }

            public void setResult(float result) {
                this.result = result;
            }

            public long getSkuFaId() {
                return skuFaId;
            }

            public void setSkuFaId(long skuFaId) {
                this.skuFaId = skuFaId;
            }

            public int getStatusId() {
                return statusId;
            }

            public void setStatusId(int statusId) {
                this.statusId = statusId;
            }

            public String getStatusName() {
                return statusName;
            }

            public void setStatusName(String statusName) {
                this.statusName = statusName;
            }

            public String getUrl() {
                return url;
            }

            public void setUrl(String url) {
                this.url = url;
            }


        }
    }


    public static class PayVo implements Serializable {

        private String id;
        private String orderCode;
        private String payCount;
        private String payMoney;
        private String payUserId;
        private String status;
        private String typeId;
        private String checkCode;
        private String stageOrderId;
        private String payOrderId;


        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getOrderCode() {
            return orderCode;
        }

        public void setOrderCode(String orderCode) {
            this.orderCode = orderCode;
        }

        public String getPayCount() {
            return payCount;
        }

        public void setPayCount(String payCount) {
            this.payCount = payCount;
        }

        public String getPayMoney() {
            return payMoney;
        }

        public void setPayMoney(String payMoney) {
            this.payMoney = payMoney;
        }

        public String getPayUserId() {
            return payUserId;
        }

        public void setPayUserId(String payUserId) {
            this.payUserId = payUserId;
        }

        public String getStatus() {
            return status;
        }

        public void setStatus(String status) {
            this.status = status;
        }

        public String getTypeId() {
            return typeId;
        }

        public void setTypeId(String typeId) {
            this.typeId = typeId;
        }

        public String getCheckCode() {
            return checkCode;
        }

        public void setCheckCode(String checkCode) {
            this.checkCode = checkCode;
        }

        public String getStageOrderId() {
            return stageOrderId;
        }

        public void setStageOrderId(String stageOrderId) {
            this.stageOrderId = stageOrderId;
        }

        public String getPayOrderId() {
            return payOrderId;
        }

        public void setPayOrderId(String payOrderId) {
            this.payOrderId = payOrderId;
        }
    }


    public String getString() {
        return data;
    }
}
